import { Component, Input, OnInit } from '@angular/core';
import { SFSchema } from '@delon/form';
import { ApiService } from '@core/services/api';
import { HttpClient } from '@angular/common/http';
import { NzMessageService, NzModalRef } from 'ng-zorro-antd';

@Component({
  selector: 'app-user-list-edit-remark',
  templateUrl: './edit-remark.component.html',
})
export class UserListEditRemarkComponent implements OnInit {
  @Input()
  set _param(value) {
    if (!value) return;
    this.param = value;
  };
  param: any;
  schema: SFSchema = {
    properties: {
      remark: {
        type: 'string',
        title: '备注',
        ui:{
          widget:"textarea",
          spanControl:12,
        }
      },
    },
  }
  formSubmit(data) {
    const body: any = {
      remark: data.remark,
    };
    const url = this.api.user.add.url;
    const method = this.api.user.add.method;
    this.http.request<any>(method, url,  { body}).subscribe(res => {
      console.log(res)
      if (res.status === '200' || res.status === '201') {
        this.msg.success('操作成功');
        this.modalRef.triggerOk();
      } else {
        this.msg.error(res.message)
      }
    })
  }
  constructor(
    private api: ApiService,
    private http: HttpClient,
    private msg: NzMessageService,
    private modalRef: NzModalRef
  ) { }

  ngOnInit(): void {
   
  }

 
}
